package com.example.demo.web.controller;


import com.example.demo.bean.BaseUserRole;
import com.example.demo.service.IBaseUserRoleService;
import com.example.demo.utils.Message;
import com.example.demo.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Validated
@RestController
@RequestMapping("/baseUserRole")
public class BaseUserRoleController {

    @Autowired
    private IBaseUserRoleService baseUserRoleService;

    @GetMapping("query")
    public Message query (Long id){
        List<BaseUserRole>list=baseUserRoleService.query(id);
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseUserRole baseUserRole){return MessageUtil.success(baseUserRoleService.saveOrUpdate(baseUserRole));}
    @DeleteMapping("deleteById")
    public Message deleteById(long id){
        baseUserRoleService.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
